Next | Prev | Up | Top | Contents | Index
Virtual Page Size
The virtual page size for 64-bit kernels is currently 16 KB, while it is 4 KB for 32-bit systems. However, various I/O hardware items (such as DMA map registers on CHALLENGE/Onyx platforms) still deal with 4 KB pages for
I/O, requiring that the driver use a different set of constants or procedures when dealing with I/O pages.
Most of the following new I/O-related items already exist without the IO_ prefix and refer to virtual memory page size rather than I/O page size.
Constants
- IO_NBPP
- number of bytes in an I/O page
- IO_PNUMSHFT
- number of bits to shift I/O address to page number
- IO_POFFMASK
- mask for offset into I/O page
Macros
- io_pnum(x)
- I/O page number from address
- io_poff(x)
- I/O page offset from address
- io_numpages(addr, len)
-
number of I/O pages to span address range starting at addr for len bytes
- io_ctob(x)
- convert I/O pages to bytes
- io_btoc(x)
- convert byte count to number of pages (rounded up)
- io_btoct(x)
- convert byte count to number of pages (rounded down)
To convert an existing driver, a good starting point would be to examine all uses of NBPP, PNUMSHFT, POFFMASK, pnum, poff, ctob, btoc, and btoct and consider:
- whether they refer to virtual memory pages and should be left alone
or
- whether they refer to I/O pages and need to be converted.
Next | Prev | Up | Top | Contents | Index